/*
 * @Copyright: 2016 www.yyfax.com Inc. All rights reserved.
 */
package com.yyfax.pay.order.data.dao;

import java.util.List;

import com.yyfax.framework.dao.BaseDao;
import com.yyfax.pay.order.model.po.PayoutOrderPO;

/**
 * 代付订单持久化接口
 *
 * @author buyi
 * @date 2017-04-12 11:09:15
 * @since 1.0.0
 */
public interface PayoutOrderDao extends BaseDao<PayoutOrderPO, Integer> {

	/**
	 * 根据主键获取实体
	 * 
	 * @user jiangmy
	 * @date 2017-04-12 11:09:15
	 * @since 1.0.0
	 * @param id 自增主键
	 * @param merchantCode 商户编号(为分表预留参数)
	 * @return
	 */
	public PayoutOrderPO selectByIdAndMerchantCode(int id, String merchantCode) throws Exception;

	/**
	 * 商户订单号查询代付订单
	 * 
	 * @author buyi
	 * @date 2017-04-18 10:29:10
	 * @since v1.0.0
	 * @param orderId
	 * @param merchantCode
	 * @return
	 */
	public PayoutOrderPO selectByOrderIdAndMerchantCode(String orderId, String merchantCode);

	/**
	 * 查询代付订单列表
	 * 
	 * @author buyi
	 * @date 2017-04-20 11:28:13
	 * @since v1.0.0
	 * @param merchantCode
	 * @param payoutBatchOrderId
	 * @return
	 */
	public List<PayoutOrderPO> selectByMerchantCodeAndPayoutBatchOrderId(String merchantCode, String payoutBatchOrderId);

	/**
	 * 更新订单状态
	 *
	 * @author wujiande
	 * @date 2018/5/11 23:46
	 * @since v2.1.5
	 * @param payoutOrderId
	 * @param state
	 * @param rspCode
	 * @param rspMsg
	 * @return 更新成功的数量
	 */
	public int updateStateByPayoutOrderId(String payoutOrderId, String state, Integer rspCode, String rspMsg);

	/**
	 * 更新订单状态
	 * 
	 * @author buyi
	 * @date 2018-05-12 04:30:08
	 * @since v2.1.5
	 * @param payoutOrderId
	 * @param origState
	 * @param destState
	 * @param rspCode
	 * @param rspMsg
	 * @return
	 */
	public int updateState(String payoutOrderId, String origState, String destState, int rspCode, String rspMsg);

	/**
	 * 根据业务订单号查询
	 * 
	 * @author buyi
	 * @date 2018-05-25 10:22:25
	 * @since v2.1.5
	 * @param busiId
	 * @return
	 */
	public PayoutOrderPO selectByPayoutOrderId(String payoutOrderId);

	/**
	 * 更新退票通知状态
	 * 
	 * @author buyi
	 * @date 2018-05-25 10:35:33
	 * @since v2.1.5
	 * @param payoutOrderId
	 * @param state
	 * @param rspCode
	 * @param rspMsg
	 * @param origIsRefund
	 * @param destIsRefund
	 * @return
	 */
	public int updateRefundState(String payoutOrderId, String state, int rspCode, String rspMsg, String origIsRefund, String destIsRefund);
}
